package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PACKAGE_NAME: com.lagou.rpc.consumer.controller
 * @NAME: QueryInfo
 * @USER: Administrator
 * @DATE: 2021/7/31
 * @TIME: 22:54
 * @YEAR: 2021
 * @MONTH: 07
 */
@RestController
public class QueryInfo {
    @RequestMapping("/query/{id}")
    public User query(@PathVariable Integer id){
        IUserService userService = (IUserService) RpcClientProxy.createProxy(IUserService.class);
        User user = userService.getById(id);
        return user;
    }
}
